package com.jyt.CollectionServiceImp;

import org.junit.Test;

import com.jyt.baseUtil.RiZhiServlet;
import com.jyt.mockClientMsgBase.MockClientMsgBase_RNpay;


public class MockClientMsg_TD4004 extends MockClientMsgBase_RNpay {

	public static String TRAN_CODE = "TD4004";

	/**
	 * testTC1001_OK���ʴ��ղ����� ���п���β�ţ� 1 ����һ�������� 2���״�����
	 * 
	 * @throws Exception
	 */
	@Test
	public Infozhuangtai testTC1001_OK(String uid, String wlid, String tmobile,
			String tverifyCode, String torderId) throws Exception {
		String orderId = torderId;
		String mobile = tmobile;
		String verifyCode = tverifyCode;

		String xml = getTD4004Xml(mobile, verifyCode, orderId);
		System.out.println("���ͱ���" + xml);
		String mac = signMsg(xml);// ��ǩ�����̻���˽Կ���м�ǩ
		String respMsg = sendMsg(xml, mac);// ������Ӧ����
		String respCode = getMsgRespCode(respMsg);

		String tran_flowid = getMsgtran_flowid(respMsg);
		String resp_desc = getMsgresp_desc(respMsg);

		System.out.println("��Ӧ����" + respMsg);
		System.out.println("������" + respCode);

		Infozhuangtai infozhuangtai = new Infozhuangtai();
		infozhuangtai.setOrderId(orderId);
		infozhuangtai.setRespCode(respCode);
		infozhuangtai.setResp_desc(resp_desc);
		infozhuangtai.setTran_flowid(tran_flowid);

		//new WuliuService().xiugaiZhifuma(wlid, tran_flowid);

		new RiZhiServlet().zhifurizhi(0.0, "ȷ�����û�֧��", uid, tran_flowid,
				"TD4004", wlid, respCode, resp_desc);

		return infozhuangtai;
	}

	public String getTD4004Xml(String mobile, String verifyCode, String orderId) {
		StringBuffer xml = new StringBuffer();
		xml.append(getMsgHeadXml(TRAN_CODE));
		xml.append("<body><mobile>").append(mobile).append("</mobile>");
		xml.append("<verify_code>").append(verifyCode).append("</verify_code>");
		xml.append("<order_id>").append(orderId).append("</order_id>");
		xml.append("</body></message>");
		return xml.toString();
	}
}
